using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Type - 分类列表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleType<T> :ModelBase<ArticleType> where T : ArticleType, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.ArticleTypeid = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return ArticleTypeid;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.ArticleTypeid=dy.ArticleTypeid;
           this.Title=dy.Title;
           this.SuperiorId=dy.SuperiorId;
           this.Path=dy.Path;
           this.TemplateId=dy.TemplateId;
           this.IsLock=dy.IsLock;
        } 

        #region 定义属性

     
         /// <summary>
        /// 分类ID
        /// </summary>
        private int _ArticleTypeid =int.MinValue;
      
        /// <summary>
        /// 分类ID
        /// </summary>
        public int ArticleTypeid
        {
            get 
            {
              return   (this._ArticleTypeid); 
            }

            set 
            {
                    _ArticleTypeid= value;  
            }
        }
       
     
         /// <summary>
        /// 名称
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 名称
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 父分类
        /// </summary>
        private int _SuperiorId =int.MinValue;
      
        /// <summary>
        /// 父分类
        /// </summary>
        public int SuperiorId
        {
            get 
            {
              return   (this._SuperiorId); 
            }

            set 
            {
                    _SuperiorId= value;  
            }
        }
       
     
         /// <summary>
        /// Path
        /// </summary>
        private String _Path = "";
      
        /// <summary>
        /// Path
        /// </summary>
        public String Path
        {
            get 
            {
              return   (this._Path); 
            }

            set 
            {
                    _Path= value;  
            }
        }
       
     
         /// <summary>
        /// 模版类别
        /// </summary>
        private int _TemplateId =int.MinValue;
      
        /// <summary>
        /// 模版类别
        /// </summary>
        public int TemplateId
        {
            get 
            {
              return   (this._TemplateId); 
            }

            set 
            {
                    _TemplateId= value;  
            }
        }
       
     
         /// <summary>
        /// 是否锁定分类
        /// </summary>
        private int _IsLock =-1;
      
        /// <summary>
        /// 是否锁定分类
        /// </summary>
        public yq.Enums.BooleanType IsLock
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsLock; 
            }

            set 
            {
                    _IsLock= value.GetHashCode(); 
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleType info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["ArticleTypeid"]!= DBNull.Value)
                  {
                  info.ArticleTypeid=Convert.ToInt32(row["ArticleTypeid"]);
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["SuperiorId"]!= DBNull.Value)
                  {
                  info.SuperiorId=Convert.ToInt32(row["SuperiorId"]);
                 }
                 
                  
                  if(row["Path"]!= DBNull.Value)
                  {
                  info.Path=row["Path"].ToString();
                 }
                 
                  
                  if(row["TemplateId"]!= DBNull.Value)
                  {
                  info.TemplateId=Convert.ToInt32(row["TemplateId"]);
                 }
                 
                  
                  if(row["IsLock"]!= DBNull.Value)
                  {
                  info.IsLock= (yq.Enums.BooleanType)(row["IsLock"]) ;
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleType info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@ArticleTypeid", DbType.Int32,ParameterTool.GetObj( info._ArticleTypeid )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@SuperiorId", DbType.Int32,ParameterTool.GetObj( info._SuperiorId )); 
            
             
                cn.AddInParameter(comm, "@Path", DbType.String,ParameterTool.GetObj( info._Path )); 
            
             
                cn.AddInParameter(comm, "@TemplateId", DbType.Int32,ParameterTool.GetObj( info._TemplateId )); 
            
             
                cn.AddInParameter(comm, "@IsLock", DbType.Int32,ParameterTool.GetObj( info._IsLock )); 
            
        } 

    } 
} 